#!/usr/bin/perl -w
use strict;

use FindBin;
use lib ("$FindBin::Bin/..", "/net/cpp-group/Leo/bin");

use db_parameters;
use run_cmd;
use parse_fasta;

print STDERR <<"HEADLINE";
888888888888888888888888888888888888888888888888888888888888888888888

    setup panda

	Description:
		create panda database for loading everything!

888888888888888888888888888888888888888888888888888888888888888888888

HEADLINE
print STDERR "\n";
print STDERR "Create panda DB...\n";
run_cmd(<<"CMD");
        $dir_panda_bin/perl/panda_setup.pl
			--user $db_user
			--host $db_host
			--recreate_db $db_name
CMD


print STDERR "\n";
print STDERR "\tLoad sequence sources...\n";
my $file_name = "$FindBin::Bin/../DB_SOURCE.LIST";
if ($ENV{GENOME_DB_PARAM_DIR})
{
	$file_name = $ENV{GENOME_DB_PARAM_DIR};
	$file_name =~ s/^(.*)\/?$/$1\/DB_SOURCE.LIST/
}
run_cmd(<<"CMD");
        $dir_panda_bin/perl/panda_load_sequence_sources.pl
			--dbname $db_name
			--seq $file_name
			--user $db_user
			--host $db_host
			--remo
CMD

system ("mkdir -p $dir_pipeline_temp");
system ("mkdir -p $dir_pipeline_errors");
system ("mkdir -p $dir_pipeline_ds_temp");
system ("mkdir -p $FindBin::Bin/sequences");

exit;

print STDERR "\n";
print STDERR "Run master update...\n";
run_cmd(<<"CMD");
        $dir_panda_bin/perl/panda_master_update.pl
			 --interactive
			 --verbose
			 --user $db_user
  			 --host $db_host
			 $db_name
CMD


print STDERR "\n";


